<?xml version="1.0" encoding="UTF-8" ?>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script type="text/javascript">
	var flag=1;
	function checkLengthAndUnique(){
		var roleIdLen=$("#roleId").val().length;
		if(roleIdLen>4){
			alertMsg.info('角色ID不能超过四位整数！');
			flag=0;
		}else{
			$.ajax({
				type:"post",
				url:"system/role/ajaxJudgeUserId.do",
				async:false,
				data:{
					"roleId":$("#roleId").val(),
				},
				success:function(data){
					if(data==1){
						flag=1;
					}else{
						alertMsg.info("角色ID重复，请重新输入！");
						flag=2;
					}
				},
				dataType:"json"
			});
		}
	}
</script>
<div class="bjui-pageContent">
	<form method="post" action="system/role/addRole.do"  class="pageForm" data-toggle="validate">
		<div class="pageFormContent" data-layout-h="0">
			<table class="table table-condensed table-hover">
                <tbody>
               		<tr>
						<td><label for="j_dialog_roleId" class="control-label x85">岗位编码：</label>
							<input type="text" name="roleId" data-rule="required" size="20" onblur="checkLengthAndUnique();"/>
						</td>
					</tr>
					<tr>
						<td><label for="j_dialog_name" class="control-label x85">岗位名称：</label>
							<input type="text" name="name" data-rule="required" size="20" />
						</td>
					</tr>
					<tr>
						<td><label for="j_dialog_remark" class="control-label x85">备注：</label>
							<input type="text" name="remark" data-rule="required" size="20" />
						</td>
					</tr>
				</tbody>
            </table>
		</div>
		 <div class="bjui-footBar">
            <ul>
                <li><button type="button" class="btn-close">关闭</button></li>
                <li><button type="submit" class="btn-default">保存</button></li>
            </ul>
        </div>
	</form>
</div>